<!DOCTYPE html>
<title>Test that an empty "source" inserted when networkState is NETWORK_EMPTY triggers resource selection, immediately changing networkState to NETWORK_NO_SOURCE.</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<video>
    <source></source>
</video>
<script>
test(function() {
    // "source" inserted by the parser.
    var video = document.querySelector("video");
    assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE);

    // "video" created with script.
    video = document.createElement("video");
    assert_equals(video.networkState, HTMLMediaElement.NETWORK_EMPTY);

    // "source" inserted by script.
    video.appendChild(document.createElement("source"));
    assert_equals(video.networkState, HTMLMediaElement.NETWORK_NO_SOURCE);
});
</script>